#include "snap.h"

Snap::Snap(QObject *parent)
    : Operation{parent}
{}

void Snap::run(){
    qDebug() << "Snap is Running!";
}

void Snap::writeXML(QXmlStreamWriter& writer){
    // 写入当前操作的信息
    writer.writeStartElement("Snap");
    writer.writeAttribute("device", m_strDeviceID);
    writer.writeEndElement();  // 结束当前操作的元素
}

void Snap::readFromXML(QXmlStreamReader& reader){
    QXmlStreamAttributes attributes = reader.attributes();
    if(attributes.hasAttribute("device")) {
        m_strDeviceID = attributes.value("device").toString();
    }

    QXmlStreamReader::TokenType token = reader.readNext();
    while (!(reader.tokenType() == QXmlStreamReader::EndElement &&
             reader.name() == QStringLiteral("Snap"))) {

        reader.readNext();
    }
}
